//
//  ZRBaseViewController.swift
//  weiboDemo
//
//  Created by 张睿 on 16/7/19.
//  Copyright © 2016年 张睿. All rights reserved.
//

import UIKit

class ZRBaseViewController: UIViewController {
// 判断用户是否登录
    let isLogin: Bool = false
// 访客视图view
    var visitorView: ZRVisitorView?
    

    override func loadView() {
        
        isLogin ? (view = tableView) : (setupVisitorView())
    }
    
    
    func setupVisitorView(){
        visitorView = ZRVisitorView()
        visitorView?.closure = {
            print("view上的登录或者注册按钮点击")
        }
        view = visitorView
        
        setupNav()
    }
    
  @objc private func loginClick() {
        print("登录或者注册按钮点击")
    }
    
    
    func setupNav(){
        
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "登录", style: UIBarButtonItemStyle.Plain, target: self, action: "loginClick")
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "注册", style: UIBarButtonItemStyle.Plain, target: self, action: "loginClick")
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()

    }

    // MARK: -  懒加载控件
    lazy var tableView: UITableView = UITableView()
    

   

}
